make sure we don't segfault when looking up a non-existant value name
authorTim Janik <timj@gtk.org>
Fri, 2 Oct 1998 21:14:26 +0000 (21:14 +0000)
committerTim Janik <timj@src.gnome.org>
Fri, 2 Oct 1998 21:14:26 +0000 (21:14 +0000)
Fri Oct  2 16:10:36 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtktypeutils.c (gtk_type_enum_find_value): make sure we don't
        segfault when looking up a non-existant value name (reported by
        Pablo <pcj+gtk@primenet.com>).

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktypeutils.c

index cfd21ebc6f515cef68663774c9180b18b0a97d83..b4c28477fe2049a614661b98ac85e3fb769a7646 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Oct  2 16:10:36 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtktypeutils.c (gtk_type_enum_find_value): make sure we don't
+       segfault when looking up a non-existant value name (reported by
+       Pablo <pcj+gtk@primenet.com>).
+
 Thu Oct  1 10:40:20 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkclist.h (gtk_clist_prepend):
index cfd21ebc6f515cef68663774c9180b18b0a97d83..b4c28477fe2049a614661b98ac85e3fb769a7646 100644 (file)
@@ -1,3 +1,9 @@
+Fri Oct  2 16:10:36 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtktypeutils.c (gtk_type_enum_find_value): make sure we don't
+       segfault when looking up a non-existant value name (reported by
+       Pablo <pcj+gtk@primenet.com>).
+
 Thu Oct  1 10:40:20 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkclist.h (gtk_clist_prepend):
index cfd21ebc6f515cef68663774c9180b18b0a97d83..b4c28477fe2049a614661b98ac85e3fb769a7646 100644 (file)
@@ -1,3 +1,9 @@
+Fri Oct  2 16:10:36 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtktypeutils.c (gtk_type_enum_find_value): make sure we don't
+       segfault when looking up a non-existant value name (reported by
+       Pablo <pcj+gtk@primenet.com>).
+
 Thu Oct  1 10:40:20 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkclist.h (gtk_clist_prepend):
index cfd21ebc6f515cef68663774c9180b18b0a97d83..b4c28477fe2049a614661b98ac85e3fb769a7646 100644 (file)
@@ -1,3 +1,9 @@
+Fri Oct  2 16:10:36 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtktypeutils.c (gtk_type_enum_find_value): make sure we don't
+       segfault when looking up a non-existant value name (reported by
+       Pablo <pcj+gtk@primenet.com>).
+
 Thu Oct  1 10:40:20 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkclist.h (gtk_clist_prepend):
index cfd21ebc6f515cef68663774c9180b18b0a97d83..b4c28477fe2049a614661b98ac85e3fb769a7646 100644 (file)
@@ -1,3 +1,9 @@
+Fri Oct  2 16:10:36 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtktypeutils.c (gtk_type_enum_find_value): make sure we don't
+       segfault when looking up a non-existant value name (reported by
+       Pablo <pcj+gtk@primenet.com>).
+
 Thu Oct  1 10:40:20 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkclist.h (gtk_clist_prepend):
index cfd21ebc6f515cef68663774c9180b18b0a97d83..b4c28477fe2049a614661b98ac85e3fb769a7646 100644 (file)
@@ -1,3 +1,9 @@
+Fri Oct  2 16:10:36 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtktypeutils.c (gtk_type_enum_find_value): make sure we don't
+       segfault when looking up a non-existant value name (reported by
+       Pablo <pcj+gtk@primenet.com>).
+
 Thu Oct  1 10:40:20 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkclist.h (gtk_clist_prepend):
index cfd21ebc6f515cef68663774c9180b18b0a97d83..b4c28477fe2049a614661b98ac85e3fb769a7646 100644 (file)
@@ -1,3 +1,9 @@
+Fri Oct  2 16:10:36 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtktypeutils.c (gtk_type_enum_find_value): make sure we don't
+       segfault when looking up a non-existant value name (reported by
+       Pablo <pcj+gtk@primenet.com>).
+
 Thu Oct  1 10:40:20 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkclist.h (gtk_clist_prepend):
index d261fbe8e99c902bab5b55a9eac9aaa693730a8c..c5a7b1923aa35bea8c4af2c2817a758ff90b03e5 100644 (file)
@@ -683,18 +683,19 @@ gtk_type_enum_find_value (GtkType        enum_type,
       GtkEnumValue *vals;
 
       vals = gtk_type_enum_get_values (enum_type);
-      while (vals)
-       {
-         if (strcmp (vals->value_name, value_name) == 0 ||
-             strcmp (vals->value_nick, value_name) == 0)
-           return vals;
-         vals++;
-       }
+      if (vals)
+       while (vals->value_name)
+         {
+           if (strcmp (vals->value_name, value_name) == 0 ||
+               strcmp (vals->value_nick, value_name) == 0)
+             return vals;
+           vals++;
+         }
     }
   else
     g_warning ("gtk_type_enum_find_value(): type `%s' is not derived from `GtkEnum' or `GtkFlags'",
               gtk_type_name (enum_type));
-
+  
   return NULL;
 }